<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./swiper-bundle.min.css" />
  <style>
    .swiper{
      width:100%;
      height:800px;
    }

    .swiper-slide{
      text-align: center;
      font-size:6em;
      line-height:500px;
    }
  </style>
</head>
<body>
  <div class="swiper">
    <!-- 滚动元素 -->
    <div class="swiper-wrapper">
      <div class="swiper-slide">滚动元素1</div>
      <div class="swiper-slide">滚动元素2</div>
      <div class="swiper-slide">滚动元素3</div>
      <div class="swiper-slide">滚动元素4</div>
    </div>

    <!-- 分页器 -->
    <div class="swiper-pagination"></div>

    <!-- 如果需要导航按钮 -->
    <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>

    <!-- 如果需要滚动条 -->
    <div class="swiper-scrollbar"></div>
  </div>
</body>
</html>
<script src="./swiper-bundle.min.js"></script>
<script>
  //初始化
  var mySwiper = new Swiper('.swiper', {
    direction: 'horizontal', //滚动方向
    loop: true, // 循环模式选项

    pagination:{  //分页器
      el: '.swiper-pagination', 
      type: 'bullets',
      clickable: true,
    },

    // 如果需要前进后退按钮
    navigation:{
      prevEl: '.swiper-button-prev',
      nextEl: '.swiper-button-next'
    },

    // 如果需要滚动条
    scrollbar: {
      el: '.swiper-scrollbar',
    },
  })
</script>